/* 
6.循环数组，筛选自己想要的字段组成新数组(map)
*/
let arr = [
  {
    id: 1,
    name: "张三",
    age: "13",
    isActive: false,
    class: "五年级",
    sex: "girl",
  },
  {
    id: 2,
    name: "张三",
    age: "14",
    isActive: true,
    class: "六年级",
    sex: "boy",
  },
];
const newArr = arr.map(({ id, name, age, sex }) => ({ id, name, age, sex }));
console.log(newArr);
//console
// [
//     { id: 1, name: '张三', age: '13', sex: 'girl' },
//     { id: 2, name: '张三', age: '14', sex: 'boy' }
//   ]
